from Base.base import Base
from selenium.webdriver.common.by import By
from utils.data_header import read_yaml
import os

class Page3(Base):
    # 获取定位信息
    current_dir = os.path.dirname(__file__)
    test_case = read_yaml(os.path.join(current_dir, '..', 'Config', 'endpoints.yaml'))
    case = test_case[2]

    jiaoyi_loc=(By.XPATH,case['jiaoyi_loc'])

    def jiaoyi(self):
        self.click(self.jiaoyi_loc)

    orderlist_loc=(By.XPATH,case['orderlist_loc'])

    def orderlist(self):
        self.click(self.orderlist_loc)

    merchantNo_loc=(By.XPATH,case['merchantNo_loc'])

    def merchantNo(self,merchantNo):
        self.send_keys(self.merchantNo_loc,merchantNo)

    merchantName_loc=(By.XPATH,case['merchantName_loc'])

    def merchantName(self,merchantName):
        self.send_keys(self.merchantName_loc,merchantName)

    merchantOrderNo_loc=(By.XPATH,case['merchantOrderNo_loc'])

    def merchantOrderNo(self,merchantOrderNo):
        self.send_keys(self.merchantOrderNo_loc,merchantOrderNo)

    status_loc=(By.XPATH,case['status_loc'])

    def status(self):
        self.select(self.status_loc,'交易成功')

    orderDateBegin_loc=(By.XPATH,case['orderDateBegin_loc'])

    def orderDateBegin(self):
        self.click(self.orderDateBegin_loc)

    year_loc=(By.NAME,case['year_loc'])

    def year(self):
        self.select(self.year_loc,'2023')

    month_loc=(By.XPATH,case['month_loc'])

    def month(self):
        self.select(self.month_loc,"十二月")

    date_loc=(By.XPATH,case['date_loc'])

    def date(self):
        self.click(self.date_loc)

    queren_loc=(By.CLASS_NAME,case['queren_loc'])

    def queren(self):
        self.click(self.queren_loc)

    payWayName_loc=(By.XPATH,case['payWayName_loc'])

    def payWayName(self):
        self.select(self.payWayName_loc,'微信')

    payTypeName_loc=(By.XPATH,case['payTypeName_loc'])

    def payTypeName(self):
        self.select(self.payTypeName_loc,'扫码支付')

    fundIntoType_loc=(By.XPATH,case['fundIntoType_loc'])

    def fundIntoType(self):
        self.select(self.fundIntoType_loc,'商家收款')

    chaxun_loc=(By.XPATH,case['chaxun_loc'])

    def chaxun(self):
        self.click(self.chaxun_loc)